//添加工作经验
new Vue({
    el: "#wap_add_work",
    data() {
        return {
            services: services,
            addCom:'',
            addStartTime:'',
            addEndTime:'',
            addDepart:'',
            addPosition:'',
            addDuty:'',
            ResumeId:''
        }
    },
    methods:{
        addWork:function () {
            this.addStartTime = $('input[name="add_start"]').val();
            this.addEndTime = $('input[name="add_end"]').val();

            if(this.addCom == ''||this.addCom==null){
                layerMsg('请输入公司名称');
                return
            }
            if(this.addStartTime == ''||this.addStartTime==null){
                layerMsg('请输入开始工作时间');
                return
            }
            if(this.addEndTime == ''||this.addEndTime==null){
                layerMsg('请输入结束工作时间');
                return
            }

            var that = this;
            $.ajax({
                url:that.services+"/user/resume/experienceWork"
                ,type:"put"
                ,contentType:"application/json;charset=utf-8"
                ,xhrFields: {
                    withCredentials: true
                }
                ,crossDomain: true
                ,data:JSON.stringify({
                    "resumeId": that.ResumeId,
                    "company": that.addCom,
                    "department": that.addDepart,
                    "position": that.addPosition,
                    "entryTime": that.addStartTime,
                    "separationTime": that.addEndTime,
                    "workContext": that.addDuty
                })
                ,success:function(res) {
                    var check = ApiLoginStatus(res);
                    if(check==false)
                        return false;
                    if(res.success){
                        layerMsg(res.message);
                        setTimeout(function() {
                            window.location.href="my-resume.html" ;
                        },500);
                    }

                }
            })
        }
    },
    created () {
        this.ResumeId = $.cookie('resumeId');
    }
});